/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author USUARIO
 */
@Entity
@Table(name = "habitacion")
@NamedQueries({
    @NamedQuery(name = "Habitacion.findAll", query = "SELECT h FROM Habitacion h")})
public class Habitacion implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "numero")
    private Integer numero;
    @Column(name = "dias_descuento")
    private Integer diasDescuento;
    @Column(name = "desc_especial")
    private Integer descEspecial;
    @OneToMany(mappedBy = "habitacion")
    private List<Reserva> reservaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "habitacion")
    private List<Estadia> estadiaList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "habitacion")
    private List<FueraServicio> fueraServicioList;
    @JoinColumn(name = "tipo", referencedColumnName = "id_tipo")
    @ManyToOne
    private TipoHabitacion tipo;

    public Habitacion() {
    }

    public Habitacion(Integer numero) {
        this.numero = numero;
    }

    public Integer getNumero() {
        return numero;
    }

    public void setNumero(Integer numero) {
        this.numero = numero;
    }

    public Integer getDiasDescuento() {
        return diasDescuento;
    }

    public void setDiasDescuento(Integer diasDescuento) {
        this.diasDescuento = diasDescuento;
    }

    public Integer getDescEspecial() {
        return descEspecial;
    }

    public void setDescEspecial(Integer descEspecial) {
        this.descEspecial = descEspecial;
    }

    public List<Reserva> getReservaList() {
        return reservaList;
    }

    public void setReservaList(List<Reserva> reservaList) {
        this.reservaList = reservaList;
    }

    public List<Estadia> getEstadiaList() {
        return estadiaList;
    }

    public void setEstadiaList(List<Estadia> estadiaList) {
        this.estadiaList = estadiaList;
    }

    public List<FueraServicio> getFueraServicioList() {
        return fueraServicioList;
    }

    public void setFueraServicioList(List<FueraServicio> fueraServicioList) {
        this.fueraServicioList = fueraServicioList;
    }

    public TipoHabitacion getTipo() {
        return tipo;
    }

    public void setTipo(TipoHabitacion tipo) {
        this.tipo = tipo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (numero != null ? numero.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Habitacion)) {
            return false;
        }
        Habitacion other = (Habitacion) object;
        if ((this.numero == null && other.numero != null) || (this.numero != null && !this.numero.equals(other.numero))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Habitacion[ numero=" + numero + " ]";
    }
    
}
